/*
Date:20210530 12:22PM
key:检查二进制中是否只有1位是1
*/
class Solution {
public:
    bool isPowerOfTwo(int n) 
    {
        if(n<=0){return 0;}
        int re=0;
        for(int i=0;i<32;i++)
        {
            if(n&1){re++;}
            n=n>>1;
        }
        if(re==1){return 1;}
        else{return 0;}
    }
};